#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <X11/Xlib.h>

#include "structures.h"

#define DD printf

static void * OpenDisplay(const int argi, const char **argc);

int main(int argi, char ** argc)
{
	OpenDisplay(argi, (const char **) argc);
	return(-1);
}


static void * OpenDisplay(const int argi, const char **argc)
{
	Display *d;
	char * env_display;
	
	/* Firsl fet from environment the DISPLAY */
	env_display = getenv("DISPLAY");
	if (NULL == env_display)
	{
		perror("Getting DISPLAY from env");
		return NULL;
	}
	
	d = XOpenDisplay(env_display);
	if (NULL == d)
	{
                perror("Can't open");
		return NULL;
	}
	else
	{
		DD("Display is opened\n");
	}
	
	return d;
}


static int CloseDisplay(void * d)
{
    if ( ! d )
	return (-1);
    XCloseDisplay(d);
    return(0);
}
